<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;

class UserRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $id = auth('box')->id();
        return [
            'mobile' => 'required|unique:users,mobile,' . $id,
        ];
    }


    /**
     * 获取已定义验证规则的错误消息。
     *
     * @return array
     */
    public function messages()
    {
        return [
            'mobile.required' => '手机号为空',
            'mobile.unique' => '手机号重复',
        ];
    }


    public $scenes = [
//        'addMsg' => ['title', 'content'],
        'setInfo' => ['mobile']
    ];


}
